// =====================================================================================
// M8Pim: Provide a convenient way to manage personal information on Meizu M8.
// Copyright (C)  2009  tiger.lee  http://tigerlee.me
// 
// GNU General Public Licence:
// ---------------------------
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or any
// later version.
// 
// This program is distributed in the hope that it will be useful,
//      but WITHOUT ANY WARRANTY; without even the implied warranty of
//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//      GNU General Public License for more details.
// 
//      You should have received a copy of the GNU General Public License
//      along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// =====================================================================================

// =====================================================================================
//     Filename: PimDataManager.cpp
//  Description: 
//
//       Create: 12/02/09 18:59:25
//       Author: tiger.lee
//        Email: i.m.tiger.lee(at)gmail.com
//      Website: http://tigerlee.me
//
//      Project: http://code.google.c/p/m8pim/
//   Bug Report: http://code.google.com/p/m8pim/issues/list
// =====================================================================================

#include "PimDataManager.h"

CPimConfig*   CPimDataManager::m_config   = NULL;
CPimDBHandle* CPimDataManager::m_dbHandle = NULL;
CPimContacts* CPimDataManager::m_contacts = NULL;
CPimMessages* CPimDataManager::m_messages = NULL;

void CPimDataManager::Init(void)
{
	m_config   = new CPimConfig;
	m_dbHandle = new CPimDBHandle(L"\\Disk\\M8Pim\\contacts.db", L"\\Disk\\M8Pim\\sms.db");
	m_contacts = new CPimContacts(m_dbHandle);
	m_contacts->Load();
	m_messages = new CPimMessages(m_dbHandle);
	m_messages->Load();
}

void CPimDataManager::Clear(void)
{
	if (m_contacts)
	{
		m_contacts->Clear();
		delete m_contacts;
		m_contacts = NULL;
	}

	if (m_messages)
	{
		m_messages->Clear();
		delete m_messages;
		m_messages = NULL;
	}
}

//=====================================================================================
// vim: ft=cpp tabstop=4 shiftwidth=4
